//
//  XCCellForSinger.m
//  TTLestening
//
//  Created by dllo on 16/3/24.
//  Copyright © 2016年 dilo. All rights reserved.
//

#import "XCCellForSinger.h"
#import "Masonry.h"


#define WIDGHT  self.contentView.frame.size.width
#define HEIGHT  self.contentView.frame.size.height

#define WIDGHTT [UIScreen mainScreen].bounds.size.width / 375
#define HEIGHTT [UIScreen mainScreen].bounds.size.height / 667


@interface XCCellForSinger ()

@property (nonatomic, strong)UIButton *buttonForSave;
@property (nonatomic, strong)UILabel *labelForSave;

@property (nonatomic, strong)UIButton *buttonForDownLoad;
@property (nonatomic, strong)UILabel *labelForDownLoad;

@property (nonatomic, strong)UIButton *buttonForShare;
@property (nonatomic, strong)UILabel *labelForShare;

@property (nonatomic, strong)UIButton *buttonForMV;
@property (nonatomic, strong)UILabel *labelForMV;


@end

@implementation XCCellForSinger

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    
    if (self) {
        
        self.contentView.backgroundColor = [UIColor redColor];
        [self createSubview];
        
    }
    
    return self;
    
}

- (void)createSubview {
    
    self.buttonForSave = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:self.buttonForSave];
    [self.buttonForSave setImage:[UIImage imageNamed:@"iconfont-weishoucang"] forState:UIControlStateNormal];
    
    self.labelForSave = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForSave];
    self.labelForSave.text = @"收藏";
    
    self.buttonForShare = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:self.buttonForShare];
    [self.buttonForShare setImage:[UIImage imageNamed:@"iconfont-fenxiang-4"] forState:UIControlStateNormal];
    
    self.labelForShare = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForShare];
    self.labelForShare.text = @"分享";
    
    self.buttonForDownLoad = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:self.buttonForDownLoad];
    [self.buttonForDownLoad setImage:[UIImage imageNamed:@"iconfont-xiazaigequ"] forState:UIControlStateNormal];
    
    self.labelForDownLoad = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForDownLoad];
    self.labelForDownLoad.text = @"下载";
    
    self.buttonForMV = [UIButton buttonWithType:UIButtonTypeCustom];
    [self.contentView addSubview:self.buttonForMV];
    [self.buttonForMV setImage:[UIImage imageNamed:@"iconfont-ttpodicon"] forState:UIControlStateNormal];
    
    self.labelForMV = [[UILabel alloc] init];
    [self.contentView addSubview:self.labelForMV];
    self.labelForMV.text = @"MV";
    
}

- (void)layoutSubviews {
    
    [super layoutSubviews];
    
    [self.buttonForSave mas_updateConstraints:^(MASConstraintMaker *make) {
        
        make.centerX.mas_equalTo(self.contentView.mas_centerX).multipliedBy(1. / 4.);
        make.top.mas_equalTo(self.contentView).equalTo(@10);
        make.height.equalTo(@(fabs((HEIGHT - 25)) / 3. * 2.));
        make.width.mas_equalTo(self.buttonForSave.mas_height).multipliedBy(1. / 1.);

    }];
    
    [self.labelForSave mas_updateConstraints:^(MASConstraintMaker *make) {
        
    
        make.centerX.mas_equalTo(self.contentView.mas_centerX).multipliedBy(1. / 4.);
        make.top.mas_equalTo(self.buttonForSave.mas_bottom).equalTo(@5);
        make.bottom.mas_equalTo(self.contentView).equalTo(@ - 10);
        make.width.mas_equalTo(self.buttonForSave.mas_height).multipliedBy(1. / 1.);

    }];
    
    
    
    [self.buttonForShare mas_updateConstraints:^(MASConstraintMaker *make) {
       
        make.centerX.mas_equalTo(self.contentView.mas_centerX).multipliedBy(3. / 4.);
        make.top.mas_equalTo(self.contentView).equalTo(@10);
        make.height.equalTo(@(fabs((HEIGHT - 25)) / 3. * 2.));
        make.width.mas_equalTo(self.buttonForShare.mas_height).multipliedBy(1. / 1.);

        
    }];
    
    [self.labelForShare mas_updateConstraints:^(MASConstraintMaker *make) {
       
        make.centerX.mas_equalTo(self.contentView.mas_centerX).multipliedBy(3. / 4.);
        make.top.mas_equalTo(self.buttonForShare.mas_bottom).equalTo(@5);
        make.bottom.mas_equalTo(self.contentView).equalTo(@ - 10);
        make.width.mas_equalTo(self.buttonForSave.mas_height).multipliedBy(1. / 1.);

    }];
    
    [self.buttonForDownLoad mas_updateConstraints:^(MASConstraintMaker *make) {
       
        make.centerX.mas_equalTo(self.contentView.mas_centerX).multipliedBy(5. / 4.);
        make.top.mas_equalTo(self.contentView).equalTo(@10);
        make.height.equalTo(@(fabs((HEIGHT - 25)) / 3. * 2.));
        make.width.mas_equalTo(self.buttonForShare.mas_height).multipliedBy(1. / 1.);
    }];
    
    [self.labelForDownLoad mas_updateConstraints:^(MASConstraintMaker *make) {
       
        make.centerX.mas_equalTo(self.contentView.mas_centerX).multipliedBy(5. / 4.);
        make.top.mas_equalTo(self.buttonForDownLoad.mas_bottom).equalTo(@5);
        make.bottom.mas_equalTo(self.contentView).equalTo(@ - 10);
        make.width.mas_equalTo(self.buttonForSave.mas_height).multipliedBy(1. / 1.);

        
    }];
    
    [self.buttonForMV mas_updateConstraints:^(MASConstraintMaker *make) {
       
        
        make.centerX.mas_equalTo(self.contentView.mas_centerX).multipliedBy(7. / 4.);
        make.top.mas_equalTo(self.contentView).equalTo(@10);
        make.height.equalTo(@(fabs((HEIGHT - 25)) / 3. * 2.));
        make.width.mas_equalTo(self.buttonForShare.mas_height).multipliedBy(1. / 1.);

    }];
    
    [self.labelForMV mas_updateConstraints:^(MASConstraintMaker *make) {
       
        make.centerX.mas_equalTo(self.contentView.mas_centerX).multipliedBy(7. / 4.);
        make.top.mas_equalTo(self.buttonForMV.mas_bottom).equalTo(@5);
        make.bottom.mas_equalTo(self.contentView).equalTo(@ - 10);
        make.width.mas_equalTo(self.buttonForSave.mas_height).multipliedBy(1. / 1.);
        
    }];
    
    
    
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

@end
